﻿using Games.Common;
using Games.Data;
using System.Collections.Generic;

namespace Games.PegSolitaire
{
    class PsRecord : GameRecords
    {
        private static readonly List<string> msgs = new List<string> {
            "天才",
            "国手",
            "隐士",
            "大师",
            "专家",
            "优秀",
        };
        public int Step { get; set; }
        public int ChessCount { get; set; }
        public bool Perfect { get; set; }
        public string Level
        {
            get
            {
                if(Perfect && ChessCount == 1)
                {
                    return msgs[0];
                }
                var message = "一般";
                if(msgs.Count > ChessCount)
                {
                    message = msgs[ChessCount];
                }
                return message;
            }
        }

        public override Record Convert()
        {
            return new Record
            {
                Level = Level,
                Message = $"{Step} 步，余棋 {ChessCount}，用时 {Utils.FormatTime((int)Duration)}",
                TimeString = CreateTime.ToString("yyyy-MM-dd HH:mm")
            };
        }
    }
}
